<!doctype HTML public "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- Click to Convert 5.2: Anything to HTML -->
<!-- http://www.clicktoconvert.com -->

<html>
<head>
<title>gravityboxscheduleuserguide - page 40 of 234</title>
<meta http-equiv=content-type content=text/html;charset=iso-8859-1>
<meta name="Generator" content="Click to Convert">

<!--Start of page styles-->
<STYLE TYPE="text/css">
<!--
 /* Foreground Image Styles */

 /* Position Styles */
 .ts40p0{position:absolute;left:106px;top:97px;}
 .ts40p1{position:absolute;left:352px;top:97px;}
 .ts40p3{position:absolute;left:672px;top:97px;}
 .ts40p7{position:absolute;left:106px;top:113px;}
 .ts40p8{position:absolute;left:706px;top:1026px;}
 .ts40p9{position:absolute;left:331px;top:1044px;}
 .ts40p13{position:absolute;left:106px;top:146px;}
 .ts40p14{position:absolute;left:106px;top:164px;}
 .ts40p15{position:absolute;left:106px;top:183px;}
 .ts40p17{position:absolute;left:106px;top:201px;}
 .ts40p18{position:absolute;left:106px;top:221px;}
 .ts40p21{position:absolute;left:106px;top:239px;}
 .ts40p23{position:absolute;left:106px;top:257px;}
 .ts40p25{position:absolute;left:106px;top:275px;}
 .ts40p27{position:absolute;left:106px;top:293px;}
 .ts40p29{position:absolute;left:106px;top:311px;}
 .ts40p31{position:absolute;left:106px;top:329px;}
 .ts40p33{position:absolute;left:106px;top:347px;}
 .ts40p35{position:absolute;left:106px;top:366px;}
 .ts40p36{position:absolute;left:106px;top:384px;}
 .ts40p38{position:absolute;left:106px;top:403px;}
 .ts40p39{position:absolute;left:106px;top:421px;}
 .ts40p40{position:absolute;left:106px;top:440px;}
 .ts40p42{position:absolute;left:106px;top:458px;}
 .ts40p43{position:absolute;left:106px;top:476px;}
 .ts40p44{position:absolute;left:106px;top:495px;}
 .ts40p46{position:absolute;left:106px;top:513px;}
 .ts40p47{position:absolute;left:106px;top:532px;}
 .ts40p49{position:absolute;left:106px;top:568px;}
 .ts40p50{position:absolute;left:106px;top:587px;}
 .ts40p51{position:absolute;left:106px;top:605px;}
 .ts40p52{position:absolute;left:106px;top:624px;}
 .ts40p54{position:absolute;left:106px;top:642px;}
 .ts40p56{position:absolute;left:106px;top:660px;}
 .ts40p57{position:absolute;left:106px;top:680px;}
 .ts40p59{position:absolute;left:106px;top:698px;}
 .ts40p61{position:absolute;left:106px;top:716px;}
 .ts40p63{position:absolute;left:106px;top:734px;}
 .ts40p65{position:absolute;left:106px;top:752px;}
 .ts40p67{position:absolute;left:106px;top:771px;}
 .ts40p68{position:absolute;left:106px;top:789px;}
 .ts40p70{position:absolute;left:106px;top:807px;}
 .ts40p71{position:absolute;left:106px;top:826px;}
 .ts40p73{position:absolute;left:106px;top:844px;}
 .ts40p74{position:absolute;left:106px;top:863px;}
 .ts40p75{position:absolute;left:106px;top:881px;}
 .ts40p77{position:absolute;left:106px;top:899px;}
 .ts40p78{position:absolute;left:106px;top:918px;}
 .ts40p80{position:absolute;left:106px;top:936px;}
 .ts40p81{position:absolute;left:106px;top:955px;}
 .ts40p83{position:absolute;left:106px;top:973px;}
 .ts40p84{position:absolute;left:106px;top:991px;}

 /* Font Styles */
 .ft0p40{font-style:normal;font-weight:bold;font-size:13px;font-family:arial,sans-serif;color:#000000;}
 .ft1p40{font-weight:normal;}
 .ft2p40{font-style:normal;font-weight:normal;font-size:13px;font-family:"times new roman","times new roman",times,serif;color:#000000;}
 .ft3p40{font-style:normal;font-weight:normal;font-size:16px;font-family:"times new roman","times new roman",times,serif;color:#000000;}
 .ft4p40{font-style:normal;font-weight:bold;font-size:11px;font-family:arial,sans-serif;color:#000000;}
 .ft5p40{font-style:normal;font-weight:normal;font-size:16px;font-family:arial,sans-serif;color:#000000;}
 .ft6p40{font-style:normal;font-weight:normal;font-size:16px;font-family:"courier new",courier,monospace;color:#000000;}
 .ft7p40{font-style:normal;font-weight:bold;font-size:21px;font-family:arial,sans-serif;color:#808080;}

 /* Background Style */
 .styleBackground40{position:absolute;left:97px;top:219px}

 /* Navigation Styles */
 .styleNavBarTop{position:absolute;left:0px;top:2px}
 .nb{position:absolute;left:2px;top:0px}
 .nbs{position:absolute;left:0px;top:0px}
 .nbe{position:absolute;left:836px;top:0px}
 .styleNavBarBot{position:absolute;left:0px;top:1117px}
-->
</STYLE>
<!--End of page styles-->

</head>
<body bgcolor="#ffffff" text="#000000" link="#0000FF" Vlink="#660099">

<table id="pageTable" width="836" STYLE="position: relative; left: auto; top: auto;"><tr><td>
<div class=nbs><img src="./navbarstart.gif" width="2" height="30"></div>
<div class=nb><img src="./navbar.gif" width="836" height="30" alt="Navigation bar"></div>
<div class=nbe><img src="./navbarend.gif" width="2" height="30"></div>
<div class=styleNavBarTop>
<table width="834" height="26" border="0" cellspacing="0">
  <tr align="left">
    <td width="4">&nbsp;</td>
    <td width="25" align="center"><a href="http://www.gravitybox.com" target="_parent"><img src="./home.gif" border="0" alt="Home"></a></td>
    <td width="25" align="center"><a href="#" onClick="window.open('./print.html','Printing','width=300,height=100,toolbar=no,directories=no');return false;"><img src="./print.gif" border="0" alt="Print document"></a></td>
    <td width="10" align="center"><img src="./separator.gif" border="0"></td>
    <td width="18" align="center"><a href="./index1.html"><img src="./start.gif" width="18" height="14" border="0" alt="Start"></a></td>
    <td width="18" align="center"><a href="./index39.html"><img src="./back.gif" width="14" height="14" border="0" alt="Previous page"></a></td>
    <td width="80" valign="middle"><table width="100%" height="16" border="0" cellspacing="1" bgcolor="#ACA899"><tr><td align="center" bgcolor="#ffffff"><font face=verdana,arial,sans-serif><font size="1">&nbsp;40 of 234&nbsp;</font></font></td></tr></table></td>
    <td width="18" align="center"><a href="./index41.html"><img src="./forward.gif" width="14" height="14" border="0" alt="Next page"></a></td>
    <td width="18" align="center"><a href="./index234.html"><img src="./end.gif" width="18" height="14" border="0" alt="End"></a></td>
    <td width="620">&nbsp;</td>
  </tr>
</table>
<p>
</div>
<nobr>
<div class=styleBackground40><img src="./background40.png" width="633" height="836" border="0" alt=""></div>
<div class=ts40p0><span class="ft0p40"> </span></div>
<div class=ts40p1><span class="ft0p40">Gravitybox Schedule Primer<span class="ft1p40"> </span></span></div>
<div class=ts40p3><span class="ft0p40">Page 38&nbsp; </span></div>
<div class=ts40p7><span class="ft2p40"> </span></div>
<div class=ts40p8><span class="ft3p40"> </span></div>
<div class=ts40p9><span class="ft4p40">1998&#45;2004 Gravitybox Software LLC<span class="ft3p40"> </span></span></div>
<div class=ts40p13><span class="ft5p40">code that is difficult to read. An alternative is to get a set an object variable to the newly </span></div>
<div class=ts40p14><span class="ft5p40">added object and set its properties. The following code declares an object variable to </span></div>
<div class=ts40p15><span class="ft5p40">point to the newly added ScheduleItem. </span></div>
<div class=ts40p17><span class="ft5p40"> </span></div>
<div class=ts40p18><span class="ft6p40">Dim oAppt As CScheduleEl </span></div>
<div class=ts40p21><span class="ft6p40">&nbsp;&nbsp; </span></div>
<div class=ts40p23><span class="ft6p40">&nbsp; Set oAppt = Schedule1.ScheduleItems.Add(&#34;Appt1&#34;, _ </span></div>
<div class=ts40p25><span class="ft6p40">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #6/3/2002#, 1, _ </span></div>
<div class=ts40p27><span class="ft6p40">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #8:00:00 AM#, 60, &#34;John Doe's Appointment&#34;) </span></div>
<div class=ts40p29><span class="ft6p40">&nbsp; oAppt.Id = newId </span></div>
<div class=ts40p31><span class="ft6p40">&nbsp; oAppt.ReadOnly = True </span></div>
<div class=ts40p33><span class="ft6p40">&nbsp; Set oAppt = Nothing<span class="ft5p40"> </span></span></div>
<div class=ts40p35><span class="ft5p40"> </span></div>
<div class=ts40p36><span class="ft5p40">Clearly, the code is much easier to read. This code will also, in theory, run faster. I say </span></div>
<div class=ts40p38><span class="ft5p40">&#147;in theory&#148;, because with this amount of code, no difference will be noticed in speed. </span></div>
<div class=ts40p39><span class="ft5p40">The object variable was not declared with the &#147;New&#148; keyword because a new object </span></div>
<div class=ts40p40><span class="ft5p40">variable of this type may not be created, nor does one ever need to do so. The Add </span></div>
<div class=ts40p42><span class="ft5p40">method of the ScheduleItems collection will create the object, add it to the collection, </span></div>
<div class=ts40p43><span class="ft5p40">and returns a reference. This reference may be used to manipulate the new object&#146;s </span></div>
<div class=ts40p44><span class="ft5p40">properties. </span></div>
<div class=ts40p46><span class="ft5p40"> </span></div>
<div class=ts40p47><span class="ft7p40">Collection Looping </span></div>
<div class=ts40p49><span class="ft5p40">The same philosophy may be applied to the other collections as well. A Room object </span></div>
<div class=ts40p50><span class="ft5p40">may be added to the Rooms collection in must the same way. A reference to it will be </span></div>
<div class=ts40p51><span class="ft5p40">returned that may be used to manipulate its properties. A Room object has an Id </span></div>
<div class=ts40p52><span class="ft5p40">property that is not defined in the Add method of the Rooms collection. The only way to </span></div>
<div class=ts40p54><span class="ft5p40">set it is after it has been added. </span></div>
<div class=ts40p56><span class="ft5p40"> </span></div>
<div class=ts40p57><span class="ft6p40">Dim oRoom As CRoomEl </span></div>
<div class=ts40p59><span class="ft6p40">&nbsp;&nbsp; </span></div>
<div class=ts40p61><span class="ft6p40">&nbsp; Set oRoom = Schedule1.Rooms.Add(&#34;Green Room&#34;) </span></div>
<div class=ts40p63><span class="ft6p40">&nbsp; oRoom.Id = 57 </span></div>
<div class=ts40p65><span class="ft6p40">&nbsp; Set oRoom = Nothing<span class="ft5p40"> </span></span></div>
<div class=ts40p67><span class="ft5p40"> </span></div>
<div class=ts40p68><span class="ft5p40">This Rooms collection will create a Room object and return a reference to the object. </span></div>
<div class=ts40p70><span class="ft5p40">The object reference is stored it in the &#147;oRoom&#148; object variable. Its &#147;Id&#148; property may </span></div>
<div class=ts40p71><span class="ft5p40">then be set. </span></div>
<div class=ts40p73><span class="ft5p40"> </span></div>
<div class=ts40p74><span class="ft5p40">This syntax may be used for all the collections of GbSchedule. An object variable for </span></div>
<div class=ts40p75><span class="ft5p40">each collection element type can be created and used to jockey the property values. </span></div>
<div class=ts40p77><span class="ft5p40">Alternately, object variables may be used in loops. This is by far the easiest way to set </span></div>
<div class=ts40p78><span class="ft5p40">property values of objects.&nbsp; </span></div>
<div class=ts40p80><span class="ft5p40"> </span></div>
<div class=ts40p81><span class="ft5p40">Many times an object&#146;s properties will need to be set using loops. There are three ways </span></div>
<div class=ts40p83><span class="ft5p40">to loop through a collection. The first has been discussed, referencing an object with an </span></div>
<div class=ts40p84><span class="ft5p40">index. An integer, looping variable is declared and a loop is constructed to walk from the </span></div>
<div class=styleNavBarBot>
<table width="836" border="0" cellspacing="2">
  <tr></tr>
  <tr>
    <td width="118"><a href="http://www.purepage.com"><img src="./smalllogo.gif" width="118" height="46" border="0" alt="http://www.purepage.com"></a></td>
    <td></td>
  </tr>
</table>
</div>

</td></tr></table>

</body>
</html>
